package com.campus.controller;

import com.campus.entry.ManagerStudent;
import com.campus.response.ResponseResult;
import com.campus.response.ResultCode;
import com.campus.service.ManagerStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student")
public class ManagerStudentController {
    @Autowired
    private ManagerStudentService managerStudentService;
    @PostMapping("/save")
    public ResponseResult<Object> saveStudent(@RequestBody ManagerStudent managerStudent){
            managerStudentService.addStudent(managerStudent);
            return new ResponseResult<>(ResultCode.ALL_SUCCESS,null);
    }
    @PostMapping("/saveLists")
    public ResponseResult<Object> saveListStudets(@RequestBody List<ManagerStudent>managerStudentList){
            managerStudentService.addStudentList(managerStudentList);
            return new ResponseResult<>(ResultCode.ALL_SUCCESS,null);
    }

}
